
/**
 * 物资管理相关接口
 */
import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'
const baseUrl = commonBaseUrl('D') || 'material/'
const zyJk = process.env.VUE_APP_ZIYUAN_NEXT_API
export const queryReceiveDetails = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/queryReceiveDetails`,
        showLoading: true,
        params
    })
}
// 查询物资出库单
export const queryOsEquipList = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/queryOsEquipList`,
        method: 'post',
        data
    })
}
// 查询物资退库单
export const queryRetreatEquipList = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/queryRetreatEquipList`,
        method: 'post',
        data
    })
}
//  整体项目查询物资退库单
export const queryBackWhole = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/queryRetreatEquipListWhole`,
        method: 'post',
        data
    })
}

// 查询申领详情页查询整体项目单项工程列表
export const getEquipList = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/getEquipList`,
        params
    })
}

// 撤销领用
export const doSaveBackInfo = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/doSaveBackInfo`,
        method: 'post',
        showLoading: true,
        data
    })
}
export const doSaveApplyBySite = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/doSaveApplyBySite`,
        method: 'post',
        showLoading: false,
        data
    })
}
export const doSaveAllApplyBySite = (data) => {
  return request({
    url: `${baseUrl}api/receive/equip/doSaveAllApplyBySite`,
    method: 'post',
    showLoading: false,
    data
  })
}
//  物资申领/撤销申领单位精度校验
export const getSpuUnitAccByMaterialCode = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/getSpuUnitAccByMaterialCode`,
        method: 'post',
        data
    })
}
// 整体项目申领下单
export const addApplyDetail = (data) => {
    return request({
        url: `${baseUrl}api/receive/equip/addApplyDetail`,
        method: 'post',
        showLoading: true,
        data
    })
}

// 获取出库单数据

export const queryOsList = (data) => {
    return request({
        url: `${baseUrl}api/retreat/queryOsList`,
        method: 'post',
        data
    })
}

export const queryOsListWhole = (data) => {
    return request({
        url: `${baseUrl}api/retreat/queryOsListWhole`,
        method: 'post',
        data
    })
}

// 常规退库

export const routineRetreatApply = (data) => {
    return request({
        url: `${baseUrl}api/retreat/routineRetreatApply`,
        method: 'post',
        data
    })
}

// 撤销退库
export const cancelRetreatApply = (data) => {
    return request({
        url: `${baseUrl}api/retreat/cancelRetreatApply`,
        method: 'post',
        data
    })
}

export const retreatQueryRetreatEquipList = (data) => {
    return request({
        url: `${baseUrl}api/retreat/queryRetreatEquipList`,
        method: 'post',
        data
    })
}
export const queryRetreatEquipListSynt = (data) => {
    return request({
        url: `${baseUrl}api/retreat/queryRetreatEquipListSynt`,
        method: 'post',
        data
    })
}
// 查询累计撤销申领列表
export const queryBackEquipList = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/queryBackEquipList`,
        params
    })
}

//  获取已出库物资标签物料列表
export const queryAssetLabelDatailList = (data) => {
    return request({
        url: `${baseUrl}api/retreat/queryAssetLabelDatailList`,
        method: 'post',
        data
    })
}

//  获取已出库物资标签物料列表
export const queryReceiveReturnOverview = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/queryReceiveReturnOverview`,
        params
    })
}
// 查询出库列表(综合查询详情页)
export const queryReceiveList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/queryReceiveList`,
        params
    })
}
// 点击出库数量
export const queryAssetLabelDatailListSynt = (data) => {
    return request({
        url: `${baseUrl}/api/retreat/queryAssetLabelDatailListSynt`,
        method: 'post',
        data
    })
}
// 一码到底物资总览列表
export const queryLableCodeList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/queryLableCodeList`,
        params,
        showLoading: true
    })
}
// 到货确认详情
export const queryLableCodeDetailList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/queryLableCodeDetailList`,
        params,
        method: 'post'
    })
}
// 换签次数弹窗接口
export const swapLableDetailList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/swapLableDetailList`,
        params
    })
}
// 未标签数量特殊接口
export const noSwapLableDetailList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/noLableDetailList`,
        params,
        method: 'post'
    })
}
// 已标签数量接口新
export const yesSwapLableDetailList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/lableOrScanDetailList`,
        params,
        method: 'post'
    })
}
// 实施阶段发起物资申领退库信息
export const implementReceiveList = (params) => {
    return request({
        url: `${baseUrl}api/pub/material/implementReceiveList`,
        params
    })
}

// 整体物资
export const queryRetreatEquipListWhole = (data) => {
    return request({
        url: `${baseUrl}api/retreat/queryRetreatEquipListWhole`,
        method: 'post',
        data
    })
}

// 跳转 api/retreat/openAssetFull
export const openAssetFull = (data) => {
    return request({
        url: `${baseUrl}api/retreat/openAssetFull`,
        method: 'post',
        data
    })
}

export const equipTypeUpdateRetreat = (data) => {
    return request({
        url: `${baseUrl}api/retreatTypeUpdate/equipTypeUpdateRetreat`,
        method: 'post',
        data
    })
}
// 同步撤销仓储
export const doRetryBackInfo = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/doRetryBackInfo`,
        method: 'post',
        params
    })
}
export const doRetryApply = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/doRetryApply`,
        method: 'post',
        params
    })
}
//  查询未同步仓储撤销申领列表

export const queryBackingEquipList = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/queryBackingEquipList`,
        params
    })
}

// 退库精度校验
export const getRetreatSpuUnitAccByMaterialCode = (params) => {
    return request({
        url: `${baseUrl}api/receive/equip/getRetreatSpuUnitAccByMaterialCode`,
        method: 'post',
        params
    })
}

// 申请退库按钮验证
export const getPrjInternalState = (params) => {
    return request({
        url: `${baseUrl}api/retreat/getPrjInternalStateAndIsNewPrj`,
        method: 'post',
        params
    })
}
// 常规退库检测是否可编辑
export const cableMateLabelIsCut = (params) => {
    return request({
        url: `${baseUrl}api/cableMateLabel/isCutAndLj?materialCode=` + params.materialCode + '&prjId=' + params.prjId+ '&osDetailId=' + params.osDetailId,
        method: 'get'
    })
}
// 全部领用
export const addAllApplyDetail = (data) => {
    return request({
        url: `${baseUrl}/api/receive/equip/addAllApplyDetail`,
        method: 'post',
        showLoading: true,
        data
    })
}

export function pushResource(params) {
    return request({
        url: `${baseUrl}/api/retreat/pushResource`,
        method: 'post',
        showLoading: true,
        params
    })
}

// 失败重推
export function updateRetreatInfoById(params) {
    return request({
        url: `${baseUrl}/api/retreat/updateRetreatInfoById`,
        method: 'post',
        params
    })
}
export function sendMaterialTransferInfo(data) {
    return request({
        url: `${baseUrl}/api/material/transfer/sendMaterialTransferInfo`,
        method: 'post',
        data
    })
}

// 跳转仓储时获取token和url
export function getShopTokenAndUrl(params) {
    return request({
        url: `${baseUrl}/api/retreat/getShopTokenAndUrl`,
        method: 'post',
        params
    })
}

// 获取项目基本信息
export function getPrjDetailApi(data) {
    return request({
        url: `${baseUrl}/api/pub/material/getIniInfoByPrjCode?prjCode=` + data,
        method: 'get'
    })
}

// 跳转仓储时获取token和url
export function getMaterialClassifyList(params) {
    return request({
        url: `${baseUrl}/api/retreat/config/list`,
        method: 'post',
        params
    })
}

// 根据物料编码查询是否在有实物允许不入库退库物料配置表
export function queryByMaterialCode(data) {
    return request({
        url: `${baseUrl}api/retreat/config/queryByMaterialCode?materialCode=` + data,
        method: 'post'
    })
}
// 判断是否要显示跨项目调整按钮
export function checkNodeByPrjId(data) {
    return request({
        url: `${baseUrl}/api/material/transfer/checkNodeByPrjId?prjId=` + data,
        method: 'get',
        hideMessage: true
    })
}
// 查询当前项目设计方案物资列表
export function queryDesignMateListByPrjId(data) {
    return request({
        url: `${baseUrl}/api/material/transfer/queryDesignMateListByPrjId?prjId=` + data.prjId+`&subPrjId=`+data.subPrjId,
        method: 'get'
    })
}
//查询调拨物资分页列表
export function queryTransferList(data) {
    return request({
        url: `${baseUrl}/api/material/transfer/queryTransferList`,
        method: 'post',
        data
    })
}
//物资调拨单位精度校验
export function getTransferUnitAccByMaterialCode(params) {
    return request({
        url: `${baseUrl}/api/material/transfer/getRetreatSpuUnitAccByMaterialCode`,
        method: 'post',
        params
    })
}
///
export function doSaveMaterialTransferInfo(data) {
    return request({
        url: `${baseUrl}/api/material/transfer/doSaveMaterialTransferInfo`,
        method: 'post',
        data
    })
}
//查询批量子项目列表
export function queryPlSonPrjCode(data) {
    return request({
        url: `${baseUrl}/api/material/transfer/queryPlSonPrjCode?prjId=` + data,
        method: 'get'
    })
}

//查询换签信息
export function querySwapLabelInfo(data) {
    return request({
        url: `${baseUrl}api/flows/swapLabelFlow/querySwapLabelInfo?bizSeq=` + data,
        method: 'post'
    })
}

//查询是否是虚拟站
export function isVirtualOrRoom(data) {
    return request({
        url: `${baseUrl}api/app/mainMaterialLable/isVirtualOrRoom?prjId=` + data,
        method: 'post'
    })
}

// 换签下一步、回退接口
export function doNextSwapLabelFLow(data) {
    return request({
        url: `${baseUrl}api/flows/swapLabelFlow/doNextSwapLabelFLow`,
        method: 'post',
        data
    })
}

export function getUserInfo(data) {
    return request({
        url: `${baseUrl}api/app/mainMaterialLable/getUserInfo?prjId=` + data,
        method: 'get'
    })
}

// 推送资源
export function insertOuterResourceReplaceLabelLog(data) {
    return request({
        url: `${zyJk}appManagerController/insertOuterResourceReplaceLabelLog`,
        method: 'post',
        data,
        hideMessage:true,
    })
}

export function getResourceReplaceLabelLog(data) {
    return request({
        url: `${zyJk}appManagerController/getResourceReplaceLabelLog`,
        method: 'post',
        data,
        hideMessage:true,
    })
}
